import { A } from 'solid-start'; import { Description, Property, QwikPreactOrReact, Solid, Title, } from '~/components';
<Title>setValues</Title> Sets multiple values of the form or a field array at once.Sets multiple values of the form or a field array at once.
// Set multiple form values
setValues(form, values, options);
// Set values of a field array
setValues(form, name, values, options);
form
<Property {...properties.form} />name
values
<Property {...properties.values} />options
<Property {...properties.options} />shouldTouched
<Property {...properties.shouldTouched} />shouldDirty
<Property {...properties.shouldDirty} />shouldValidate
<Property {...properties.shouldValidate} />shouldFocus
<Property {...properties.shouldFocus} />
By default, the fields are set to touched and the dirty state is updated. If you don't want this, you can set shouldTouched
and/or shouldDirty
to false
.
By default, the fields are validated according to the rules defined in the options
of the createForm
primitiveuseForm
hook. To disable validation you can set shouldValidate
to false
.
By default, a field is focused when an error occurs during validation. To change this behavior you can set shouldFocus
to false
.
export const properties = { form: { type: { type: 'custom', name: 'FormStore', href: '../FormStore', }, }, values: { type: [ { type: 'custom', name: 'FieldValues', href: '../FieldValues', }, { type: 'array', item: [ { type: 'custom', name: 'FieldValues', href: '../FieldValues', }, { type: 'custom', name: 'FieldValue', href: '../FieldValue', }, ], }, ], }, options: { type: 'object', defaultValue: { type: 'object', entries: [] }, }, shouldTouched: { type: 'boolean', defaultValue: { type: 'boolean', value: true }, }, shouldDirty: { type: 'boolean', defaultValue: { type: 'boolean', value: true }, }, shouldValidate: { type: 'boolean', defaultValue: { type: 'boolean', value: true }, }, shouldFocus: { type: 'boolean', defaultValue: { type: 'boolean', value: true }, }, };